//我们的主线程和自己创建的线程都属于前台线程，他会阻止线程的结束
public class Demo6 {
    public static void main(String[] args) throws InterruptedException {
        Thread t=new Thread(()->{
            for (int i=0;i<5;i++){
                System.out.println("hello world");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            }
            System.out.println("t线程结束！");
        });
        t.start();
        Thread.sleep(1000);
        System.out.println("主线程结束！");
    }
}
